<%@ page language="java" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" errorPage="" %>
<%@ page import="java.util.*" %>
<%@ page import="com.auth.domain.T_function" %>
<link rel="stylesheet" href="<%=basePath%>portal/css/adminFont.css">
<link rel="stylesheet" href="<%=basePath%>portal/css/hhUI.css">
<link rel="stylesheet" href="<%=basePath%>portal/css/gardenAdminIndex.css">
<link rel="stylesheet" href="<%=basePath%>portal/css/head.css">
<link rel="stylesheet" href="<%=basePath%>css/font-awesome.min.css">
<script src="<%=basePath%>js/jquery-1.8.3.min.js"></script>
<script src="<%=basePath%>js/adminIndex.js"></script>
<ul>
    <!-- 合起展开 -->
    <li class="toggle-menu">
        <i class="fa fa-2x fa-angle-double-left" aria-hidden="true"></i>
        <i class="fa fa-2x fa-angle-double-right shrink" aria-hidden="true"></i>
    </li>

    <!-- 首页
    <li>
        <a target="iframe"
           href="estate_management"
           class="first-menu"><i class="iconfont"></i><span>首页</span></a>
    </li>
    <li>
        <div class="first-menu " 120="">
            <i class="iconfont "> &#59190</i>
            <span>楼栋房源</span>
            <i class="slide-icon hh-iconfont"> </i><i class="slide-icon hh-iconfont slidedown"> </i>
        </div>
    </li>
    <div class="second-menu" style="">
        <a href="javascript:changepath('<%=basePath%>ONLINEUSERLIST');">
            <i class="hh-iconfont">&#59097;</i><span>楼栋管理</span>
        </a>
        <a href="javascript:changepath('<%=basePath%>ONLINEUSERLIST');">
            <i class="hh-iconfont">&#59135;</i><span>房源管理</span>
        </a>
    </div>
 -->

    <%
        String systemid = request.getParameter("systemid");
        System.out.println("------....................leftDivs.jsp getAttribute('systemid')=" + systemid);
        List functList = (List) request.getSession().getAttribute("FREE_USER_AUTH");
        StringBuffer menuInfo = new StringBuffer();
        String flag = "";
        String url = "";
        try {
            if (functList != null) {
                Iterator it = functList.iterator();
                while (it.hasNext()) {
                    T_function f = (T_function) it.next();
                    System.out.println("------.....................f.getSystemid()=" + f.getSystemid());
                    System.out.println("------.....................systemid.equals(f.getSystemid())?=" + systemid.equals(f.getSystemid()));

                    //如果是等于要显示的系统菜单，才输出显示；
                    if (systemid.equals(f.getSystemid())) {
                        if (f.getFunctlevel().equals("1")) {
                            if (flag.equals("2")) { //第一次时为空；所以不会输出闭合；
                                menuInfo.append("</div>"); //首先闭合没有下级或者下级输出完毕的一级functname；
                            }
                            flag = "1";

                            //输出1级菜单，顺序后台已经排好；前端顺序输出即可；
                            //menuInfo.append("	<div class='panel-heading'>");
                            //menuInfo.append("		<a class='open-menu green-left' href='#collapse" + f.getFunctid() + "' data-toggle='collapse' data-parent='#accordion'> <span class='" + f.getPic() + "'></span> <span>" + f.getFunctname() + "</span> <span class='glyphicon glyphicon-menu-left pull-right'></span> </a>");
                            //menuInfo.append("	</div>");
                            //menuInfo.append("	<div id='collapse" + f.getFunctid() + "' class='panel-collapse collapse '>");
                            //menuInfo.append("		<ul>");

                            //<span class='" + f.getPic() + "'>
                            menuInfo.append("<li>");
                            menuInfo.append("<div class='first-menu'>");
                            menuInfo.append("<i class='iconfont'>&#59054;</i>");
                            menuInfo.append("       <span>" + f.getFunctname() + "</span>");
                            menuInfo.append("<i class='fa fa-angle-down' style='float:right;padding-top: 14px;font-size:16px;'></i><i class='fa fa-angle-up slidedown' style='float:right;padding-top: 14px;font-size:16px'></i>");
                            menuInfo.append("   </div>");
                            menuInfo.append("</li>");
                            menuInfo.append("<div class='second-menu' style=''>");


                        }
                        if (f.getFunctlevel().equals("2")) {
                            //menuInfo.append("<li ><a href='"+basePath + f.getUrl()+"&functname="+f.getFunctname()+"&functid="+f.getFunctid()+"' target='mainFrame' style='color:black'><i class='"+f.getPic()+"'></i>"+f.getFunctname()+"</a></li>");
                            flag = "2";
                            //输出2级菜单，顺序后台已经排好；前端顺序输出即可；
                            //url = basePath + f.getUrl()+"&functname="+f.getFunctname()+"&functid="+f.getFunctid();
                            url = basePath + f.getUrl() + "&functname=&functid=" + f.getFunctid();
                            //System.out.println("------.....................url=" + url);
                            //menuInfo.append("		<li><a href='"+url+"' target='ranhengFrame' > <span class='"+f.getPic()+"'></span> <span>"+f.getFunctname()+"</span></a></li>");
                            //menuInfo.append("		<li><a href='javascript:changepath(\"" + url + "\");'  > <span class='" + f.getPic() + "'></span> <span>" + f.getFunctname() + "</span></a></li>");

                            menuInfo.append("<a href='javascript:changepath(encodeURI(encodeURI(\"" + url + "\")));'><span class='" + f.getPic() + "'></span> <span>" + f.getFunctname() + "</span></a>");
                            //menuInfo.append("<i class='hh-iconfont'> </i><span>楼栋管理</span>");
                            //menuInfo.append("</a>");
                        }
                    } //end if systemid；
                } //end while;
                //如果是输出到了2级结束，就不会再走到while循环，所以此次循环结束后需要再次判断是否是否要输出对等的</ul></div>封闭
                if (flag.equals("2")) { //第一次时为空；所以不会输出闭合；
                    //menuInfo.append("</ul></div>"); //首先闭合没有下级或者下级输出完毕的一级functname；
                    menuInfo.append("</div>");
                }
            } //end if;
            System.out.println("------.....................menuInfo=" + menuInfo.toString());
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("加载系统菜单出错=" + e.toString());
        }

    %>
    <%=menuInfo.toString()%>

</ul>

